/* 重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'Arial', sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    overflow: hidden;
    user-select: none;
}

/* 游戏容器 */
#gameContainer {
    width: 1200px;
    height: 800px;
    margin: 0 auto;
    background: #000;
    border: 2px solid #2E86AB;
    position: relative;
    box-shadow: 0 0 20px rgba(46, 134, 171, 0.5);
}

/* 顶部信息栏 */
#topInfoBar {
    width: 100%;
    height: 60px;
    background: linear-gradient(90deg, #2E86AB 0%, #A23B72 100%);
    display: flex;
    align-items: center;
    justify-content: space-around;
    color: white;
    font-size: 14px;
    font-weight: bold;
    border-bottom: 2px solid #F18F01;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.info-item .icon {
    font-size: 16px;
}

/* 游戏主区域 */
#gameArea {
    width: 100%;
    height: 740px;
    position: relative;
    background: linear-gradient(90deg, 
        #C73E1D 0%, 
        #87CEEB 12.5%, 
        #87CEEB 70.8%, 
        #708090 100%);
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    background: transparent;
    cursor: crosshair;
}

/* 游戏区域覆盖层 */
#gameOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    pointer-events: none;
}

.game-zone {
    pointer-events: all;
}

#iranLaunchArea {
    width: 150px;
    background: rgba(199, 62, 29, 0.1);
    border-right: 2px dashed #C73E1D;
}

#seaArea {
    width: 700px;
    background: rgba(135, 206, 235, 0.1);
}

#defenseArea {
    width: 350px;
    background: rgba(112, 128, 144, 0.1);
    border-left: 2px dashed #2E86AB;
    position: relative;
}

/* 防御网格 */
.defense-grid {
    position: absolute;
    border: 1px solid rgba(46, 134, 171, 0.3);
    cursor: pointer;
    transition: background-color 0.2s;
}

.defense-grid:hover {
    background-color: rgba(46, 134, 171, 0.2);
    border-color: #2E86AB;
}

.defense-grid.occupied {
    background-color: rgba(46, 134, 171, 0.4);
    cursor: not-allowed;
}

.defense-grid.selected {
    background-color: rgba(241, 143, 1, 0.3);
    border-color: #F18F01;
}

/* 武器选择菜单 */
#weaponSelectionMenu {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: linear-gradient(180deg, #708090 0%, #2F4F4F 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    border-top: 2px solid #F18F01;
    z-index: 10;
}

.weapon-btn {
    width: 120px;
    height: 80px;
    background: linear-gradient(135deg, #2E86AB 0%, #1e5a8a 100%);
    border: 2px solid #F18F01;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    position: relative;
}

.weapon-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(241, 143, 1, 0.3);
    border-color: #FFB627;
}

.weapon-btn.selected {
    background: linear-gradient(135deg, #F18F01 0%, #e67e00 100%);
    border-color: #FFB627;
}

.weapon-btn img {
    width: 24px;
    height: 24px;
    margin-bottom: 5px;
}

.weapon-btn span {
    font-size: 10px;
    font-weight: bold;
    text-align: center;
}

.weapon-btn .cost {
    font-size: 8px;
    color: #FFB627;
    position: absolute;
    bottom: 5px;
    right: 5px;
}

/* 游戏状态指示器 */
.game-status {
    position: absolute;
    top: 70px;
    left: 10px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #2E86AB;
    border-radius: 5px;
    padding: 10px;
    color: white;
    font-size: 12px;
    z-index: 100;
}

.game-status h4 {
    margin: 0 0 8px 0;
    color: #2E86AB;
    font-size: 13px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    margin: 3px 0;
}

.status-value {
    font-weight: bold;
    color: #F18F01;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    #gameContainer {
        transform: scale(0.8);
        transform-origin: top center;
    }
}

@media (max-width: 960px) {
    #gameContainer {
        transform: scale(0.6);
        transform-origin: top center;
    }
}

/* 游戏实体样式 */
.missile {
    position: absolute;
    z-index: 5;
}

.defense-system {
    position: absolute;
    z-index: 3;
}

.building {
    position: absolute;
    z-index: 2;
}

.explosion {
    position: absolute;
    z-index: 6;
    pointer-events: none;
}

/* 特效动画 */
@keyframes explosion {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.explosion-effect {
    animation: explosion 0.5s ease-out forwards;
}

@keyframes missileTrail {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.5);
    }
}

.missile-trail {
    animation: missileTrail 0.3s linear infinite;
}

/* 调试模式样式 */
.debug-info {
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px;
    font-size: 10px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

/* 加载画面 */
.loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 1000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #F18F01;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
}

.loading-progress {
    font-size: 14px;
    opacity: 0.8;
}
